title: “Painéis de Vigilância” author: “Plataforma de Vigilância Molecular do Instituto Gonçalo Moniz (FIOCRUZ-BA)” date: ‘atualizado em 2023-01-17 às 21:35:08’ output: flexdashboard::flex_dashboard: vertical_layout: fill social: [“twitter”, “facebook”] source_code: “https://github.com/pvm-igm/pvm-igm.github.io/blob/main/index.Rmd” theme: version: 4 bg: “#FFFFFF” fg: “#000000” primary: “#A5FBBD” navbar-bg: “#188139” base_font: google: Arimo heading_font: google: Arimo code_font: google: family: Arimo local: false —

.section.sidebar {
background-color:#FFFFFF;
color: #000000;
}

.storyboard-nav .sbframelist ul li.active {
background-color: #25C457;
color: #FFFFFF;
}

.value-box .value {
color: #FFFFFF;
}

.value-box .caption {
color: #FFFFFF;
}

Página Inicial

Coluna 1

flexdashboard::valueBox(
  value = "",
  caption = "SARS-CoV-2 — DIAGNÓSTICO",
  color = "#25C457",
  href = "#sars2diag")

flexdashboard::valueBox(
  value = "",
  caption = "SARS-CoV-2 — SEQUENCIAMENTO",
  color = "#25C457",
  href = "#sars2seq")

PVM — Diagnóstico

Coluna 1

redcap_sars2diag_igm <- REDCapR::redcap_report(
  redcap_uri = "https://bdp.bahia.fiocruz.br/api/",
  token = "33892C42D73BBCDE1187966BED3FC475",
  report_id = 14365)$data
## 3,710 records and 11 columns were read from REDCap in 1.8 seconds.  The http status code was 200.
names(redcap_sars2diag_igm) <- c("rec", "data_teste", "placa_id", "termociclador", "kit_pcr", "lote_pcr",
                                    "result_pcr", "ct_b2m", "ct_orflab", "ct_covn", "ct_gene4")
redcap_sars2diag_igm$data_teste <- format(as.Date(redcap_sars2diag_igm$data_teste, format = "%d/%m/%Y"), "%Y-%m-%d")

# redcap_sars2diag_gal <- REDCapR::redcap_report(
#   redcap_uri = "https://bdp.bahia.fiocruz.br/api/",
#   token = "431A5D970FFD7855F1A5542CC1662EA5",
#   report_id = 14362)$data

redcap_sars2diag_gal_raw_path <- args[1]
redcap_sars2diag_gal_raw <- read.csv(file.path(redcap_sars2diag_gal_raw_path, paste0("REDCap_DIAGCOVID19_DATA_", Sys.Date(), ".csv")),
                   header = TRUE, sep = ",", stringsAsFactors = TRUE)
redcap_sars2diag_gal_raw <- redcap_sars2diag_gal_raw %>% mutate_all(na_if, "")

redcap_sars2diag_gal <- redcap_sars2diag_gal_raw[c("rec", "requisitante", "dt_coleta", "mun_req", "idade", "sexo",
                   "dt_recebimento", "dt_liberacao", "data_teste", "placa_id", "termociclador", "kit_pcr",
                   "lote_pcr", "result_pcr", "ct_b2m", "ct_orflab", "ct_covn", "ct_gene4")]
redcap_sars2diag_gal <- redcap_sars2diag_gal[!is.na(redcap_sars2diag_gal$data_teste), ]

redcap_sars2diag_gal_val <- redcap_sars2diag_gal_raw[c("rec", "requisitante", "dt_coleta", "mun_req", "idade", "sexo",
                   "dt_recebimento", "dt_liberacao", "data_teste_val", "placa_id_val", "termociclador_val", "kit_pcr_val",
                   "lote_pcr_val", "result_pcr_val", "ct_b2m_val", "ct_orflab_val", "ct_covn_val")]
names(redcap_sars2diag_gal_val) <- c("rec", "requisitante", "dt_coleta", "mun_req", "idade", "sexo",
                   "dt_recebimento", "dt_liberacao", "data_teste", "placa_id", "termociclador", "kit_pcr",
                   "lote_pcr", "result_pcr", "ct_b2m", "ct_orflab", "ct_covn")
redcap_sars2diag_gal_val <- redcap_sars2diag_gal_val[!is.na(redcap_sars2diag_gal_val$data_teste), ]

redcap_sars2diag <- Reduce(function(x, y) merge(x, y, all = TRUE), list(redcap_sars2diag_igm, redcap_sars2diag_gal, redcap_sars2diag_gal_val))
redcap_sars2diag <- redcap_sars2diag[!is.na(as.numeric(as.character(redcap_sars2diag$rec))), ]

redcap_sars2diag_rtqpcr <- n_distinct(redcap_sars2diag$placa_id)

flexdashboard::valueBox(redcap_sars2diag_rtqpcr, 
         caption = "PLACAS DE RT-qPCR",
         icon = "fa-computer",
         color = "#25C457")
743

redcap_sars2diag_diag <- length(redcap_sars2diag$rec)

flexdashboard::valueBox(redcap_sars2diag_diag, 
         caption = "AMOSTRAS TESTADAS",
         icon = "fa-barcode",
         color = "#25C457")
46205

redcap_sars2diag_tpa <- redcap_sars2diag[c("dt_recebimento", "dt_liberacao")]
redcap_sars2diag_tpa$tpa <- as.Date(as.character(redcap_sars2diag$dt_liberacao), format="%Y-%m-%d") -
                  as.Date(as.character(redcap_sars2diag$dt_recebimento), format="%Y-%m-%d")
redcap_sars2diag_tpa <- redcap_sars2diag_tpa %>% filter(!is.na(tpa))

redcap_sars2diag_tpa_median <- as.integer(median(redcap_sars2diag_tpa$tpa))

flexdashboard::valueBox(redcap_sars2diag_tpa_median, 
         caption = "DIAS PARA LIBERAÇÃO DOS RESULTADOS",
         icon = "fa-circle-check",
         color = "#25C457")
3

Coluna 2

Distribuição dos resultados de RT-qPCR para SARS-CoV-2 por semana epidemiológica

redcap_sars2diag$epiypcr <- format(as.Date(redcap_sars2diag$data_teste), "%Y")
redcap_sars2diag$epimpcr <- format(as.Date(redcap_sars2diag$data_teste), "%Y-%m")
redcap_sars2diag$epiwpcr <- format(as.Date(redcap_sars2diag$data_teste), "%G-%V")

redcap_sars2diag$result_pcr[redcap_sars2diag$result_pcr == "Detectável"] <- "Detectado"
redcap_sars2diag$result_pcr[redcap_sars2diag$result_pcr == "Nao Detectado"] <- "Nao detectado"
redcap_sars2diag$result_pcr[redcap_sars2diag$result_pcr == "Não detectado"] <- "Nao detectado"

redcap_sars2diag_result <- filter(redcap_sars2diag, grepl("Detectado|Nao detectado", result_pcr, ignore.case = TRUE))

redcap_sars2diag_result_epiwpcr <- ddply(redcap_sars2diag_result, .(redcap_sars2diag_result$epiwpcr, redcap_sars2diag_result$result_pcr), nrow, .drop = TRUE)
names(redcap_sars2diag_result_epiwpcr) <- c("epiwpcr", "result", "freq")
redcap_sars2diag_result_epiwpcr <- mutate(redcap_sars2diag_result_epiwpcr,
                                label = ifelse(result == "Nao detectado", "SARS-CoV-2 não detectado", "SARS-CoV-2 detectado"))

# redcap_sars2diag_result_epiwpcr_plot <- plotly::ggplotly(dynamicTicks = TRUE,
redcap_sars2diag_result_epiwpcr_plot <- plotly::ggplotly(
  ggplot() +
  geom_col(data = redcap_sars2diag_result_epiwpcr, aes(x = epiwpcr, y = freq, fill = label),
           position = position_fill(reverse = TRUE), width = .95, alpha = .6) +
  labs(x = NULL, y = NULL, fill = NULL) +
  scale_x_discrete(expand = expansion(0, 0)) +
  scale_y_continuous(labels = scales::percent, expand = expansion(0, 0)) +
  scale_fill_manual(values = c(
    "SARS-CoV-2 detectado" = "#EC4B63",
    "SARS-CoV-2 não detectado" = "#6BCFEF")) + theme_light() +
  theme(axis.text.x = element_text(angle = 45, vjust = 1, hjust = 1, size = 8),
        axis.text.y = element_text(hjust = 1, size = 8),
        legend.text = element_text(size = 8))) %>%
layout(legend = list(bgcolor = "#FFFFFF80", bordercolor = "#B3B3B3", borderwidth = .5,
                     orientation = 'h', xanchor = "center", x = 0.5, y = .97))
# rangeslider() %>% layout(legend = list(bgcolor = "#FFFFFF80", bordercolor = "#B3B3B3", borderwidth = .5,
                                        #  orientation = 'h', xanchor = "center", x = 0.5, y = 1), yaxis = list(autorange = FALSE))
redcap_sars2diag_result_epiwpcr_plot
# htmlwidgets::saveWidget(as_widget(redcap_sars2diag_result_epiwpcr_plot), "redcap_sars2diag_result_epiwpcr_plot.html")

Proporção de amostras SARS-CoV-2 positivas e negativas

redcap_sars2diag_result_epiypcr <- ddply(redcap_sars2diag_result, .(redcap_sars2diag_result$epiypcr, redcap_sars2diag_result$result_pcr), nrow, .drop = TRUE)
names(redcap_sars2diag_result_epiypcr) <- c("epiypcr", "result", "freq")
redcap_sars2diag_result_epiypcr <- mutate(redcap_sars2diag_result_epiypcr,
                                label = ifelse(result == "Nao detectado", "SARS-CoV-2 não detectado", "SARS-CoV-2 detectado"))
redcap_sars2diag_result_epiypcr$label2 <- paste(redcap_sars2diag_result_epiypcr$epiypcr, redcap_sars2diag_result_epiypcr$label, sep = " - ")

color_label = c("#EA2F4B", "#24AFDD", "#EA2F4B", "#24AFDD", "#EA2F4B", "#24AFDD", "#EA2F4B", "#24AFDD")
names(color_label) <- redcap_sars2diag_result_epiypcr$label

color_label2 = c("#F37F9061", "#C9F2FF", "#F37F9061", "#C9F2FF", "#F37F90C8", "#B2E9FB", "#EC4B63", "#6BCFEF")
names(color_label2) <- redcap_sars2diag_result_epiypcr$label

redcap_sars2diag_result_epiypcr_plot <- plot_ly(type = "pie", textinfo = "percent") %>%
  add_pie(data = redcap_sars2diag_result_epiypcr, label = ~label2, values = ~freq, hole = .75,
          marker = list(colors = color_label2, line = list(color = "#FFFFFF", width = 2)),
          rotation = 146, sort = TRUE, showlegend = FALSE) %>%
  add_pie(data = redcap_sars2diag_result_epiypcr, labels = ~label, values = ~freq,
          marker = list(colors = color_label, line = list(color = "#FFFFFF", width = 2)),
          rotation = 276, domain = list(x = c(0.15, 0.85), y = c(0.15, 0.85)), sort = FALSE) %>%
  layout(legend = list(bgcolor = "#FFFFFF80", bordercolor = "#B3B3B3", borderwidth = .5, x = 1, y = 1))
# rangeslider() %>% layout(legend = list(bgcolor = "#FFFFFF80", bordercolor = "#B3B3B3", borderwidth = .5,
                                        #  orientation = 'h', xanchor = "center", x = 0.5, y = 1), yaxis = list(autorange = FALSE))
redcap_sars2diag_result_epiypcr_plot
# htmlwidgets::saveWidget(as_widget(redcap_sars2diag_result_epiypcr_plot), "redcap_sars2diag_result_epiypcr_plot.html")

Coluna 3

Amostras recebidas pela PVM distribuídas por município requisitante e semana epidemiológica

redcap_sars2diag_mun_req <- redcap_sars2diag %>% filter(!is.na(mun_req))
redcap_sars2diag_mun_req <- ddply(redcap_sars2diag, .(redcap_sars2diag_mun_req$epimpcr, redcap_sars2diag_mun_req$epiwpcr, redcap_sars2diag_mun_req$mun_req), nrow, .drop = TRUE)
names(redcap_sars2diag_mun_req) <- c("epimpcr", "epiwpcr", "mun_req", "freq")
redcap_sars2diag_mun_req$mun_req <- as.character(redcap_sars2diag_mun_req$mun_req)
redcap_sars2diag_mun_req$mun_req[redcap_sars2diag_mun_req$mun_req == "ARACAJU"] <- "Aracaju (SE)"
redcap_sars2diag_mun_req$mun_req[redcap_sars2diag_mun_req$mun_req == "BANZAE"] <- "Banzaê (BA)"
redcap_sars2diag_mun_req$mun_req[redcap_sars2diag_mun_req$mun_req == "BARRA DA ESTIVA"] <- "Barra da Estiva (BA)"
redcap_sars2diag_mun_req$mun_req[redcap_sars2diag_mun_req$mun_req == "CACHOEIRA"] <- "Cachoeira (BA)"
redcap_sars2diag_mun_req$mun_req[redcap_sars2diag_mun_req$mun_req == "CAMACARI"] <- "Camaçari (BA)"
redcap_sars2diag_mun_req$mun_req[redcap_sars2diag_mun_req$mun_req == "EUCLIDES DA CUNHA"] <- "Euclides da Cunha (BA)"
redcap_sars2diag_mun_req$mun_req[redcap_sars2diag_mun_req$mun_req == "GLORIA"] <- "Glória (BA)"
redcap_sars2diag_mun_req$mun_req[redcap_sars2diag_mun_req$mun_req == "IBOTIRAMA"] <- "Ibotirama (BA)"
redcap_sars2diag_mun_req$mun_req[redcap_sars2diag_mun_req$mun_req == "ILHEUS"] <- "Ilhéus (BA)"
redcap_sars2diag_mun_req$mun_req[redcap_sars2diag_mun_req$mun_req == "IRECE"] <- "Irecê (BA)"
redcap_sars2diag_mun_req$mun_req[redcap_sars2diag_mun_req$mun_req == "ITAMARAJU"] <- "Itamaraju (BA)"
redcap_sars2diag_mun_req$mun_req[redcap_sars2diag_mun_req$mun_req == "JUAZEIRO"] <- "Juazeiro (BA)"
redcap_sars2diag_mun_req$mun_req[redcap_sars2diag_mun_req$mun_req == "LAURO DE FREITAS"] <- "Lauro de Freitas (BA)"
redcap_sars2diag_mun_req$mun_req[redcap_sars2diag_mun_req$mun_req == "MUQUEM DE SAO FRANCISCO"] <- "Muquém de São Francisco (BA)"
redcap_sars2diag_mun_req$mun_req[redcap_sars2diag_mun_req$mun_req == "PAULO AFONSO"] <- "Paulo Afonso (BA)"
redcap_sars2diag_mun_req$mun_req[redcap_sars2diag_mun_req$mun_req == "PORTO SEGURO"] <- "Porto Seguro (BA)"
redcap_sars2diag_mun_req$mun_req[redcap_sars2diag_mun_req$mun_req == "RODELAS"] <- "Rodelas (BA)"
redcap_sars2diag_mun_req$mun_req[redcap_sars2diag_mun_req$mun_req == "SALVADOR"] <- "Salvador (BA)"
redcap_sars2diag_mun_req$mun_req[redcap_sars2diag_mun_req$mun_req == "TEOTONIO VILELA"] <- "Teotônio Vilela (AL)"
redcap_sars2diag_mun_req$mun_req <- as.factor(redcap_sars2diag_mun_req$mun_req)

# redcap_sars2diag_mun_req_epiwpcr_plot <- plotly::ggplotly(dynamicTicks = TRUE,
redcap_sars2diag_mun_req_epiwpcr_plot <- plotly::ggplotly(
  ggplot() +
  geom_col(data = redcap_sars2diag_mun_req, aes(x = epiwpcr, y = freq, fill = mun_req),
           width = .95, alpha = .6) +
  labs(x = NULL, y = NULL, fill = NULL) +
  scale_x_discrete(expand = expansion(0, 0)) +
  scale_y_continuous(expand = expansion(0, 0), limits = c(0, 1000)) +
  scale_fill_manual(values = c(
    "Aracaju (SE)" = "#A9FF77",
    "Banzaê (BA)" = "#2F67CD",
    "Barra da Estiva (BA)" = "#DF2A8E",
    "Cachoeira (BA)" = "#EECB3A",
    "Camaçari (BA)" = "#B50B0B",
    "Euclides da Cunha (BA)" = "#36DF3B",
    "Glória (BA)" = "#6F0F84",
    "Ibotirama (BA)" = "#11961B",
    "Ilhéus (BA)" = "#EF8E91",
    "Irecê (BA)" = "#38A9A2",
    "Itamaraju (BA)" = "#999999",
    "Juazeiro (BA)" = "#722410",
    "Lauro de Freitas (BA)" = "#73FBFD",
    "Muquém de São Francisco (BA)" = "#C99EFD",
    "Paulo Afonso (BA)" = "#FE0B12",
    "Porto Seguro (BA)" = "#D860CF",
    "Rodelas (BA)" = "#413E3E",
    "Salvador (BA)" = "#FF7F07",
    "Teotônio Vilela (AL)" = "#E49074")) + theme_light() +
  theme(axis.text.x = element_text(angle = 45, vjust = 1, hjust = 1, size = 8),
        axis.text.y = element_text(hjust = 1, size = 8),
        legend.text = element_text(size = 8))) %>%
layout(legend = list(bgcolor = "#FFFFFF80", bordercolor = "#B3B3B3", borderwidth = .5))
# rangeslider() %>% layout(legend = list(bgcolor = "#FFFFFF80", bordercolor = "#B3B3B3", borderwidth = .5),
                          #  yaxis = list(autorange = FALSE))
redcap_sars2diag_mun_req_epiwpcr_plot
# htmlwidgets::saveWidget(as_widget(redcap_sars2diag_mun_req_epiwpcr_plot), "redcap_sars2diag_mun_req_epiwpcr_plot.html")

Amostras recebidas pela PVM distribuídas por município requisitante e mês

# redcap_sars2diag_mun_req_epimpcr_plot <- plotly::ggplotly(dynamicTicks = TRUE,
redcap_sars2diag_mun_req_epimpcr_plot <- plotly::ggplotly(
  ggplot() +
  geom_col(data = redcap_sars2diag_mun_req, aes(x = epimpcr, y = freq, fill = mun_req),
           width = .95, alpha = .6) +
  labs(x = NULL, y = NULL, fill = NULL) +
  scale_x_discrete(expand = expansion(0, 0)) +
  scale_y_continuous(expand = expansion(0, 0), limits = c(0, 4000)) +
  scale_fill_manual(values = c(
    "Aracaju (SE)" = "#A9FF77",
    "Banzaê (BA)" = "#2F67CD",
    "Barra da Estiva (BA)" = "#DF2A8E",
    "Cachoeira (BA)" = "#EECB3A",
    "Camaçari (BA)" = "#B50B0B",
    "Euclides da Cunha (BA)" = "#36DF3B",
    "Glória (BA)" = "#6F0F84",
    "Ibotirama (BA)" = "#11961B",
    "Ilhéus (BA)" = "#EF8E91",
    "Irecê (BA)" = "#38A9A2",
    "Itamaraju (BA)" = "#999999",
    "Juazeiro (BA)" = "#722410",
    "Lauro de Freitas (BA)" = "#73FBFD",
    "Muquém de São Francisco (BA)" = "#C99EFD",
    "Paulo Afonso (BA)" = "#FE0B12",
    "Porto Seguro (BA)" = "#D860CF",
    "Rodelas (BA)" = "#413E3E",
    "Salvador (BA)" = "#FF7F07",
    "Teotônio Vilela (AL)" = "#E49074")) + theme_light() +
  theme(axis.text.x = element_text(angle = 45, vjust = 1, hjust = 1, size = 8),
        axis.text.y = element_text(hjust = 1, size = 8),
        legend.text = element_text(size = 8))) %>%
layout(legend = list(bgcolor = "#FFFFFF80", bordercolor = "#B3B3B3", borderwidth = .5))
# rangeslider() %>% layout(legend = list(bgcolor = "#FFFFFF80", bordercolor = "#B3B3B3", borderwidth = .5),
                          #  yaxis = list(autorange = FALSE))
redcap_sars2diag_mun_req_epimpcr_plot
# htmlwidgets::saveWidget(as_widget(redcap_sars2diag_mun_req_plot), "redcap_sars2diag_mun_req_plot.html")

PVM — Diagnóstico (Storyboard)

Distribuição dos resultados de RT-qPCR para SARS-CoV-2 por semana epidemiológica

redcap_sars2diag_result_epiwpcr_plot

Proporção de amostras SARS-CoV-2 positivas e negativas

redcap_sars2diag_result_epiypcr_plot

Amostras recebidas pela PVM distribuídas por município requisitante e semana epidemiológica

redcap_sars2diag_mun_req_epiwpcr_plot

Amostras recebidas pela PVM distribuídas por município requisitante e mês

redcap_sars2diag_mun_req_epimpcr_plot

PVM — Sequenciamento

Coluna 1

redcap_sars2seq <- REDCapR::redcap_report(
  redcap_uri = "https://bdp.bahia.fiocruz.br/api/",
  token = "4C641796E93F1C48BA26CE090DD0BFE8",
  report_id = 12817)$data
## 4,593 records and 54 columns were read from REDCap in 7.8 seconds.  The http status code was 200.
# redcap_sars2seq <- read.csv(file.path("C:/OneDrive/OneDrive - FIOCRUZ/Sequenciamento/BANCO_DE_DADOS",
#                              paste0("redcap_sars2sequenciamentoDeSARS_DATA_", Sys.Date(), ".csv")),
#                    header = TRUE, sep = ",", stringsAsFactors = TRUE)

redcap_sars2seq_assay <- n_distinct(redcap_sars2seq$nome_seq)

flexdashboard::valueBox(redcap_sars2seq_assay, 
         caption = "SEQUENCIAMENTOS REALIZADOS",
         icon = "fa-laptop-code",
         color = "#25C457")
43

redcap_sars2seq_sample <- n_distinct(redcap_sars2seq$seq_id)

flexdashboard::valueBox(redcap_sars2seq_sample, 
         caption = "AMOSTRAS SEQUENCIADAS",
         icon = "fa-vial-virus",
         color = "#25C457")
4593

redcap_sars2seq_gi <- sum(grepl("EPI_ISL", redcap_sars2seq$gisaid_id))

flexdashboard::valueBox(redcap_sars2seq_gi, 
         caption = "GENOMAS DEPOSITADOS NO GISAID",
         icon = "fa-cloud-arrow-up",
         color = "#25C457")
3756

Coluna 2

Produção de genomas de SARS-CoV-2 da FIOCRUZ-BA

redcap_sars2seq$epimseq <- format(as.Date(redcap_sars2seq$dt_se), "%Y-%m")
redcap_sars2seq$epimseq <- format(as.Date(redcap_sars2seq$dt_se), "%Y-%m")
redcap_sars2seq$epiwseq <- format(as.Date(redcap_sars2seq$dt_se), "%G-%V")

redcap_sars2seq_filt_gi <- redcap_sars2seq %>% filter(!is.na(gisaid_id))

redcap_sars2seq_filt_nogi <- redcap_sars2seq %>% filter(is.na(gisaid_id))

redcap_sars2seq_gi <- count(redcap_sars2seq_filt_gi$epimseq)
names(redcap_sars2seq_gi) <- c("epimseq", "submitted")

redcap_sars2seq_nogi <- count(redcap_sars2seq_filt_nogi$epimseq)
names(redcap_sars2seq_nogi) <- c("epimseq", "unsubmitted")

redcap_sars2seq_gen <- merge(x = redcap_sars2seq_gi, y = redcap_sars2seq_nogi, by = "epimseq", all = TRUE)
redcap_sars2seq_gen[is.na(redcap_sars2seq_gen)] <- 0
redcap_sars2seq_gen <- melt(redcap_sars2seq_gen, id.vars = "epimseq", variable.name = "gisaid")
redcap_sars2seq_gen <- mutate(redcap_sars2seq_gen, label = ifelse(gisaid == "submitted", "Online no GISAID", "Baixa cobertura (<90%)"))

redcap_sars2seq_gen_1 <- redcap_sars2seq_gen %>% filter(redcap_sars2seq_gen$gisaid == "unsubmitted")

redcap_sars2seq_gen_2 <- redcap_sars2seq_gen %>% filter(redcap_sars2seq_gen$gisaid == "submitted")

# redcap_sars2seq_gen_plot <- plotly::ggplotly(dynamicTicks = TRUE,
redcap_sars2seq_gen_plot <- plotly::ggplotly(
  ggplot() +
  geom_line(data = redcap_sars2seq_gen_1, linewidth = 0.6, linetype = "dotted",
            aes(x = epimseq, y = value, group = gisaid, colour = label)) +
  geom_line(data = redcap_sars2seq_gen_2, linewidth = 0.8,
            aes(x = epimseq, y = value, group = gisaid, colour = label)) +
  labs(x = NULL, y = NULL) +
  scale_x_discrete(expand = expansion(0, 0)) +
  scale_y_continuous(expand = expansion(0, 0), limits = c(0, 800)) +
  theme_light() + theme(axis.text.x = element_text(angle = 45, vjust = 1, hjust = 1, size = 8),
                        axis.text.y = element_text(hjust = 1, size = 8)) +
  scale_color_manual(name = NULL, values = c("#6BCFEF", "#EC4B63"))) %>%
layout(legend = list(bgcolor = "#FFFFFF80", bordercolor = "#B3B3B3", borderwidth = .5,
                     orientation = 'h', xanchor = "center", x = 0.5, y = .97))
# rangeslider() %>% layout(legend = list(bgcolor = "#FFFFFF80", bordercolor = "#B3B3B3", borderwidth = .5,
                                        #  orientation = 'h', xanchor = "center", x = 0.5, y = 1), yaxis = list(autorange = FALSE))
redcap_sars2seq_gen_plot
# htmlwidgets::saveWidget(as_widget(redcap_sars2seq_gen_plot), "redcap_sars2seq_gen_plot.html")

Genomas de SARS-CoV-2 da Bahia submetidos no GISAID

## https://www.epicov.org/epi3/start
credentials <- login(username = "RKhour0", password = "pjtWGX7!")

gi_acc_id <- query(credentials = credentials, fast = TRUE,
                   location = "South America / Brazil / Bahia")
## Selecting all 8862 accession_ids.
## Returning 0-8862 of 8862 accession_ids.
gi_acc_id <- gi_acc_id$accession_id

gi_acc_id_split <- split(gi_acc_id, ceiling(seq_along(gi_acc_id) / 2000))

gi_raw <- data.frame()
for (i in 1:length(gi_acc_id_split)){
  temp <- download(credentials = credentials,
                   list_of_accession_ids = gi_acc_id_split[[i]],
                   get_sequence = FALSE)
  gi_raw <- rbind(gi_raw, temp)}
## Selecting entries...
## Compressing data. Please wait...
## Data ready.
## Downloading...
## Selecting entries...
## Compressing data. Please wait...
## Data ready.
## Downloading...
## Selecting entries...
## Compressing data. Please wait...
## Data ready.
## Downloading...
## Selecting entries...
## Compressing data. Please wait...
## Data ready.
## Downloading...
## Selecting entries...
## Compressing data. Please wait...
## Data ready.
## Downloading...
gi_raw$epimseq <- format(as.Date(gi_raw$date), "%Y-%m")
gi_raw$epiwseq <- format(as.Date(gi_raw$date), "%G-%V")
gi_raw$length <- as.numeric(gi_raw$length)

gi <- gi_raw[gi_raw$length > 25000, ]

## https://www.cdc.gov/coronavirus/2019-ncov/variants/variant-info.html
## 2022 Dec 25
sc2_variants <- list(
    "B.1" = "B.1",
    "B.1.1" = "B.1.1",
    "B.1.1.28" = "B.1.1.28",
    "B.1.1.33" = "B.1.1.33",
    "VBM: Alpha" = c("B.1.1.7", unique(gi$pangolin_lineage[grep("^Q\\.", gi$pangolin_lineage)])),
    # "VBM: Beta" = c("B.1.351", unique(gi$pangolin_lineage[grep("^B.1.351\\.", gi$pangolin_lineage)])),
    "VBM: Gamma" = c("P.1", unique(gi$pangolin_lineage[grep("^P\\.1\\.", gi$pangolin_lineage)])),
    "VBM: Delta" = c("B.1.617.2", unique(gi$pangolin_lineage[grep('^AY\\.', gi$pangolin_lineage)])),
    # "VBM: Epsilon" = c("B.1.427", "B.1.429"),
    # "VBM: Eta" = "B.1.525",
    # "VBM: Iota" = "B.1.526",
    # "VBM: Kappa" = "B.1.617.1",
    # "VBM: Mu" = c("B.1.621", "B.1.621.1"),
    "VBM: Zeta" = "P.2",
    "VOC: Omicron (BA.1)" = c("B.1.1.529", "BA.1", unique(gi$pangolin_lineage[grep("^BA\\.1\\.", gi$pangolin_lineage)])),
    "VOC: Omicron (BA.2)" = c("BA.2", unique(gi$pangolin_lineage[grep("^BA\\.2\\.", gi$pangolin_lineage)])),
    "VOC: Omicron (BA.3)" = c("BA.3", unique(gi$pangolin_lineage[grep("^BA\\.3\\.", gi$pangolin_lineage)])),
    "VOC: Omicron (BA.4)" = c("BA.4", unique(gi$pangolin_lineage[grep("^BA\\.4\\.", gi$pangolin_lineage)])),
    "VOC: Omicron (BA.5)" = c("BA.5", unique(gi$pangolin_lineage[grep("^BA\\.5\\.", gi$pangolin_lineage)])),
    "VOC: Omicron (BQ.1)" = c("BQ.1", unique(gi$pangolin_lineage[grep("^BQ\\.1\\.", gi$pangolin_lineage)])),
    "VOC: Omicron (XBB)" = c("XBB", unique(gi$pangolin_lineage[grep("^XBB\\.", gi$pangolin_lineage)])),
    "VOC: Omicron (BE.9)" = "BE.9",
    "VOC: Omicron (DL.1)" = c("DL.1", unique(gi$pangolin_lineage[grep("^DL\\.1\\.", gi$pangolin_lineage)])))

sc2_oms <- structure(c(rep(names(sc2_variants), sapply(sc2_variants, length))),
                     .Names = c(unlist(sc2_variants)))

gi$oms <- ifelse(gi$pangolin_lineage %in% names(sc2_oms),
                      sc2_oms[gi$pangolin_lineage], "Others")

# gi_check_others <- filter(gi, grepl("Others", oms, ignore.case = FALSE))
# gi_check_others <- gi_check_others[c("date", "pangolin_lineage", "oms")]

gi_fiocruz <- filter(gi, grepl("FIOCRUZ", submitting_lab, ignore.case = TRUE))
gi_fiocruz <- count(gi_fiocruz$epimseq)
names(gi_fiocruz) <- c("epimseq", "fiocruz")

gi_pvm <- filter(gi, grepl("PVM", submitting_lab, ignore.case = TRUE))
gi_pvm <- count(gi_pvm$epimseq)
names(gi_pvm) <- c("epimseq", "pvm")

gi_others <- filter(gi, !grepl("FIOCRUZ|PVM", submitting_lab, ignore.case = FALSE))
gi_others <- count(gi_others$epimseq)
names(gi_others) <- c("epimseq", "others")

gi_gen <- Reduce(function(x, y) merge(x, y, all = TRUE), list(gi_fiocruz, gi_pvm, gi_others))
gi_gen[is.na(gi_gen)] <- 0

gi_gen_1 <- gi_gen[,!names(gi_gen) %in% "pvm"]
gi_gen_1 <- melt(gi_gen_1, id.vars = "epimseq", variable.name = "lab")
gi_gen_1 <- mutate(gi_gen_1, label = ifelse(lab == "fiocruz", "Rede Genômica FIOCRUZ", "Outros"))

gi_gen_2 <- gi_gen[,!names(gi_gen) %in% c("fiocruz", "others")]
gi_gen_2 <- melt(gi_gen_2, id.vars = "epimseq", variable.name = "lab")
gi_gen_2 <- mutate(gi_gen_2, label = "PVM (FIOCRUZ-BA)")

# gi_gen_plot <- plotly::ggplotly(dynamicTicks = TRUE,
gi_gen_plot <- plotly::ggplotly(
  ggplot() +
  geom_line(data = gi_gen_1, linewidth = 0.6, linetype = "dotted",
            aes(x = epimseq, y = value, group = lab, colour = label)) +
  geom_line(data = gi_gen_2, linewidth = 0.8,
            aes(x = epimseq, y = value, group = lab, colour = label)) +
  labs(x = NULL, y = NULL) +
  scale_x_discrete(expand = expansion(0, 0)) +
  scale_y_continuous(expand = expansion(0, 0), limits = c(0, 1500)) +
  scale_color_manual(name = NULL, values = c("#6BCFEF", "#EC4B63", "#EC4B63")) +
  theme_light() + theme(axis.text.x = element_text(angle = 45, vjust = 1, hjust = 1, size = 8),
                        axis.text.y = element_text(hjust = 1, size = 8))) %>%
layout(legend = list(bgcolor = "#FFFFFF80", bordercolor = "#B3B3B3", borderwidth = .5,
                     orientation = 'h', xanchor = "center", x = 0.5, y = .97))
# rangeslider() %>% layout(legend = list(bgcolor = "#FFFFFF80", bordercolor = "#B3B3B3", borderwidth = .5,
                                        #  orientation = 'h', xanchor = "center", x = 0.5, y = 1), yaxis = list(autorange = FALSE))
gi_gen_plot
# htmlwidgets::saveWidget(as_widget(gi_gen_plot), "gi_gen_plot.html")

Coluna 3

Distribuição na Bahia das linhagens de SARS-CoV-2 por semana epidemiológica

gi_bahia_epiwseq <- ddply(gi, .(gi$epiwseq, gi$oms), nrow, .drop = FALSE)
names(gi_bahia_epiwseq) <- c("epiwseq", "variants", "freq")

# gi_bahia_epiwseq_plot <- plotly::ggplotly(dynamicTicks = TRUE,
gi_bahia_epiwseq_plot <- plotly::ggplotly(
  ggplot() +
  geom_col(data = gi_bahia_epiwseq, aes(x = epiwseq, y = freq, fill = variants),
           position = position_fill(reverse = TRUE), width = .95, alpha = .6) +
  labs(x = NULL, y = NULL, fill = NULL) +
  scale_x_discrete(expand = expansion(0, 0)) +
  scale_y_continuous(labels = scales::percent, expand = expansion(0, 0)) +
  scale_fill_manual(values = c(
    "B.1" = "#FF5744",
    "B.1.1" = "#FA9084",
    "B.1.1.28" = "#E49074",
    "B.1.1.33" = "#FD9EA2",
    "VBM: Alpha" = "#DF2A8E",
    "VBM: Zeta" = "#872B15",
    "VBM: Gamma" = "#11961B",
    "VBM: Delta" = "#6F0F84",
    "VOC: Omicron (BA.1)" = "#EECB3A",
    "VOC: Omicron (BA.2)" = "#FE0B12",
    "VOC: Omicron (BA.4)" = "#D860CF",
    "VOC: Omicron (BA.5)" = "#2F67CD",
    "VOC: Omicron (BQ.1)" = "#FF7F07",
    "VOC: Omicron (XBB)" = "#36DF3B",
    "VOC: Omicron (BE.9)" = "#73FBFD",
    "VOC: Omicron (DL.1)" = "#B50B0B",
    "Others" = "#999999")) + theme_light() +
  theme(axis.text.x = element_text(angle = 45, vjust = 1, hjust = 1, size = 8),
        axis.text.y = element_text(hjust = 1, size = 8),
        legend.text = element_text(size = 8))) %>%
layout(legend = list(bgcolor = "#FFFFFF80", bordercolor = "#B3B3B3", borderwidth = .5), yaxis = list(autorange = FALSE))
# rangeslider() %>% layout(legend = list(bgcolor = "#FFFFFF80", bordercolor = "#B3B3B3", borderwidth = .5),
                          #  yaxis = list(autorange = FALSE))
gi_bahia_epiwseq_plot
# htmlwidgets::saveWidget(as_widget(gi_bahia_epiwseq_plot), "gi_bahia_epimseq_plot.html")

Distribuição em Salvador (BA)

gi_salvador <- filter(gi, grepl("salvador", location, ignore.case = TRUE))

gi_salvador_epiwseq <- ddply(gi_salvador, .(gi_salvador$epiwseq, gi_salvador$oms), nrow, .drop = FALSE)
names(gi_salvador_epiwseq) <- c("epiwseq", "variants", "freq")

# gi_salvador_epiwseq <- plotly::ggplotly(dynamicTicks = TRUE,
gi_salvador_epiwseq <- plotly::ggplotly(
  ggplot() +
  geom_col(data = gi_salvador_epiwseq, aes(x = epiwseq, y = freq, fill = variants),
           position = position_fill(reverse = TRUE), width = .95, alpha = .6) +
  labs(x = NULL, y = NULL, fill = NULL) +
  scale_x_discrete(expand = expansion(0, 0)) +
  scale_y_continuous(labels = scales::percent, expand = expansion(0, 0)) +
  scale_fill_manual(values = c(
    "B.1" = "#FF5744",
    "B.1.1" = "#FA9084",
    "B.1.1.28" = "#E49074",
    "B.1.1.33" = "#FD9EA2",
    "VBM: Alpha" = "#DF2A8E",
    "VBM: Zeta" = "#872B15",
    "VBM: Gamma" = "#11961B",
    "VBM: Delta" = "#6F0F84",
    "VOC: Omicron (BA.1)" = "#EECB3A",
    "VOC: Omicron (BA.2)" = "#FE0B12",
    "VOC: Omicron (BA.4)" = "#D860CF",
    "VOC: Omicron (BA.5)" = "#2F67CD",
    "VOC: Omicron (BQ.1)" = "#FF7F07",
    "VOC: Omicron (XBB)" = "#36DF3B",
    "VOC: Omicron (BE.9)" = "#73FBFD",
    "VOC: Omicron (DL.1)" = "#B50B0B",
    "Others" = "#999999")) + theme_light() +
  theme(axis.text.x = element_text(angle = 45, vjust = 1, hjust = 1, size = 8),
        axis.text.y = element_text(hjust = 1, size = 8),
        legend.text = element_text(size = 8))) %>%
layout(legend = list(bgcolor = "#FFFFFF80", bordercolor = "#B3B3B3", borderwidth = .5), yaxis = list(autorange = FALSE))
# rangeslider() %>% layout(legend = list(bgcolor = "#FFFFFF80", bordercolor = "#B3B3B3", borderwidth = .5),
                          #  yaxis = list(autorange = FALSE))
gi_salvador_epiwseq
# htmlwidgets::saveWidget(as_widget(gi_salvador_epiwseq), "gi_salvador_epiwseq.html")

Distribuição em Irecê (BA)

gi_irece <- filter(gi, grepl("irece", location, ignore.case = TRUE))

gi_irece_epiwseq <- ddply(gi_irece, .(gi_irece$epiwseq, gi_irece$oms), nrow, .drop = FALSE)
names(gi_irece_epiwseq) <- c("epiwseq", "variants", "freq")

# gi_irece_epiwseq_plot <- plotly::ggplotly(dynamicTicks = TRUE,
gi_irece_epiwseq_plot <- plotly::ggplotly(
  ggplot() +
  geom_col(data = gi_irece_epiwseq, aes(x = epiwseq, y = freq, fill = variants),
           position = position_fill(reverse = TRUE), width = .95, alpha = .6) +
  labs(x = NULL, y = NULL, fill = NULL) +
  scale_x_discrete(expand = expansion(0, 0)) +
  scale_y_continuous(labels = scales::percent, expand = expansion(0, 0)) +
  scale_fill_manual(values = c(
    "B.1" = "#FF5744",
    "B.1.1" = "#FA9084",
    "B.1.1.28" = "#E49074",
    "B.1.1.33" = "#FD9EA2",
    "VBM: Alpha" = "#DF2A8E",
    "VBM: Zeta" = "#872B15",
    "VBM: Gamma" = "#11961B",
    "VBM: Delta" = "#6F0F84",
    "VOC: Omicron (BA.1)" = "#EECB3A",
    "VOC: Omicron (BA.2)" = "#FE0B12",
    "VOC: Omicron (BA.4)" = "#D860CF",
    "VOC: Omicron (BA.5)" = "#2F67CD",
    "VOC: Omicron (BQ.1)" = "#FF7F07",
    "VOC: Omicron (XBB)" = "#36DF3B",
    "VOC: Omicron (BE.9)" = "#73FBFD",
    "VOC: Omicron (DL.1)" = "#B50B0B",
    "Others" = "#999999")) + theme_light() +
  theme(axis.text.x = element_text(angle = 45, vjust = 1, hjust = 1, size = 8),
        axis.text.y = element_text(hjust = 1, size = 8),
        legend.text = element_text(size = 8))) %>%
layout(legend = list(bgcolor = "#FFFFFF80", bordercolor = "#B3B3B3", borderwidth = .5), yaxis = list(autorange = FALSE))
# rangeslider() %>% layout(legend = list(bgcolor = "#FFFFFF80", bordercolor = "#B3B3B3", borderwidth = .5),
                          #  yaxis = list(autorange = FALSE))
gi_irece_epiwseq_plot
# htmlwidgets::saveWidget(as_widget(gi_irece_epiwseq_plot), "gi_irece_epiwseq_plot.html")

PVM — Sequenciamento (Storyboard)

Produção de genomas de SARS-CoV-2 da FIOCRUZ-BA

redcap_sars2seq_gen_plot

Genomas de SARS-CoV-2 da Bahia submetidos no GISAID

gi_gen_plot

Distribuição na Bahia das linhagens de SARS-CoV-2 por semana epidemiológica

gi_bahia_epiwseq_plot

Distribuição em Salvador (BA) das linhagens de SARS-CoV-2 por semana epidemiológica

gi_salvador_epiwseq

Distribuição em Irecê (BA) das linhagens de SARS-CoV-2 por semana epidemiológica

gi_irece_epiwseq_plot

HSR — Sequenciamento

Coluna 1

hsr <- redcap_sars2seq %>% filter(redcap_sars2seq$req_sequenc == "HSR")

hsr_seq <- n_distinct(hsr$nome_seq)

flexdashboard::valueBox(hsr_seq, 
         caption = "SEQUENCIAMENTOS REALIZADOS",
         icon = "fa-laptop-code",
         color = "#25C457")
12

hsr_sample <- n_distinct(hsr$seq_id)

flexdashboard::valueBox(hsr_sample, 
         caption = "AMOSTRAS SEQUENCIADAS",
         icon = "fa-solid fa-vial-virus",
         color = "#25C457")
832

hsr_gi <- sum(grepl("EPI_ISL", hsr$gisaid_id))

flexdashboard::valueBox(hsr_gi, 
         caption = "GENOMAS DEPOSITADOS NO GISAID",
         icon = "fa-cloud-arrow-up",
         color = "#25C457")
703

Coluna 2

Produção de genomas de SARS-CoV-2 da FIOCRUZ-BA

hsr_filt_gi <- hsr %>% filter(!is.na(gisaid_id))

hsr_filt_nogi <- hsr %>% filter(is.na(gisaid_id))

hsr_gi <- count(hsr_filt_gi$epimseq)
names(hsr_gi) <- c("epimseq", "submitted")

hsr_nogi <- count(hsr_filt_nogi$epimseq)
names(hsr_nogi) <- c("epimseq", "unsubmitted")

hsr_gen <- merge(x = hsr_gi, y = hsr_nogi, by = "epimseq", all = TRUE)
hsr_gen[is.na(hsr_gen)] <- 0
hsr_gen <- melt(hsr_gen, id.vars = "epimseq", variable.name = "gisaid")
hsr_gen <- mutate(hsr_gen, label = ifelse(gisaid == "submitted", "Online no GISAID", "Baixa cobertura (<90%)"))

hsr_gen_1 <- hsr_gen %>% filter(hsr_gen$gisaid == "unsubmitted")
hsr_gen_2 <- hsr_gen %>% filter(hsr_gen$gisaid == "submitted")

# hsr_gen_plot <- plotly::ggplotly(dynamicTicks = TRUE,
hsr_gen_plot <- plotly::ggplotly(
  ggplot() +
  geom_line(data = hsr_gen_1, linewidth = 0.6, linetype = "dotted",
            aes(x = epimseq, y = value, group = gisaid, colour = label)) +
  geom_line(data = hsr_gen_2, linewidth = 0.8,
            aes(x = epimseq, y = value, group = gisaid, colour = label)) +
  labs(x = NULL, y = NULL) +
  scale_x_discrete(expand = expansion(0, 0)) +
  scale_y_continuous(expand = expansion(0, 0), limits = c(0, 300)) +
  theme_light() + theme(axis.text.x = element_text(angle = 45, vjust = 1, hjust = 1, size = 8),
                        axis.text.y = element_text(hjust = 1, size = 8)) +
  scale_color_manual(name = NULL, values = c("#6BCFEF", "#EC4B63"))) %>%
layout(legend = list(bgcolor = "#FFFFFF80", bordercolor = "#B3B3B3", borderwidth = .5,
                     orientation = 'h', xanchor = "center", x = 0.5, y = .97))
# rangeslider() %>% layout(legend = list(bgcolor = "#FFFFFF80", bordercolor = "#B3B3B3", borderwidth = .5,
                                        #  orientation = 'h', xanchor = "center", x = 0.5, y = 1), yaxis = list(autorange = FALSE))
hsr_gen_plot
# htmlwidgets::saveWidget(as_widget(hsr_gen_plot), "hsr_gen_plot.html")

Genomas de SARS-CoV-2 da Bahia submetidos no GISAID

gi_hsr <- filter(gi, grepl("São Rafael|Sao Rafael", originating_lab, ignore.case = TRUE))

gi_hsr_pvm <- filter(gi_hsr, grepl("FIOCRUZ", submitting_lab, ignore.case = TRUE))
gi_hsr_pvm <- count(gi_hsr_pvm$epimseq)
names(gi_hsr_pvm) <- c("epimseq", "pvm")

gi_hsr_hsr <- filter(gi_hsr, !grepl("FIOCRUZ|LACEN", submitting_lab, ignore.case = TRUE))
gi_hsr_hsr <- count(gi_hsr_hsr$epimseq)
names(gi_hsr_hsr) <- c("epimseq", "hsr")

gi_hsr_lacen_ba <- filter(gi_hsr, !grepl("FIOCRUZ|São Rafael", submitting_lab, ignore.case = TRUE))
gi_hsr_lacen_ba <- count(gi_hsr_lacen_ba$epimseq)
names(gi_hsr_lacen_ba) <- c("epimseq", "lacen-ba")

gi_hsr_gen <- Reduce(function(x, y) merge(x, y, all = TRUE), list(gi_hsr_pvm, gi_hsr_hsr, gi_hsr_lacen_ba))
gi_hsr_gen[is.na(gi_hsr_gen)] <- 0

gi_hsr_gen_1 <- gi_hsr_gen[,!names(gi_hsr_gen) %in% "pvm"]
gi_hsr_gen_1 <- melt(gi_hsr_gen_1, id.vars = "epimseq", variable.name = "lab")
gi_hsr_gen_1 <- mutate(gi_hsr_gen_1, label = ifelse(lab == "hsr", "IDOR Hospital São Rafael", "LACEN-BA"))

gi_hsr_gen_2 <- gi_hsr_gen[,!names(gi_hsr_gen) %in% c("hsr", "lacen-ba")]
gi_hsr_gen_2 <- melt(gi_hsr_gen_2, id.vars = "epimseq", variable.name = "lab")
gi_hsr_gen_2 <- mutate(gi_hsr_gen_2, label = "PVM (FIOCRUZ-BA)")

# gi_hsr_gen_plot <- plotly::ggplotly(dynamicTicks = TRUE,
gi_hsr_gen_plot <- plotly::ggplotly(
  ggplot() +
  geom_line(data = gi_hsr_gen_1, linewidth = 0.6, linetype = "dotted",
            aes(x = epimseq, y = value, group = lab, colour = label)) +
  geom_line(data = gi_hsr_gen_2, linewidth = 0.8,
            aes(x = epimseq, y = value, group = lab, colour = label)) +
  labs(x = NULL, y = NULL) +
  scale_x_discrete(expand = expansion(0, 0)) +
  scale_y_continuous(expand = expansion(0, 0), limits = c(0, 60)) +
  theme_light() + theme(axis.text.x = element_text(angle = 45, vjust = 1, hjust = 1, size = 8),
                        axis.text.y = element_text(hjust = 1, size = 8)) +
  scale_color_manual(name = NULL, values = c("#6BCFEF", "#12934A", "#EC4B63"))) %>%
layout(legend = list(bgcolor = "#FFFFFF80", bordercolor = "#B3B3B3", borderwidth = .5,
                     orientation = 'h', xanchor = "center", x = 0.5, y = .97))
# rangeslider() %>% layout(legend = list(bgcolor = "#FFFFFF80", bordercolor = "#B3B3B3", borderwidth = .5,
                                        #  orientation = 'h', xanchor = "center", x = 0.5, y = 1), yaxis = list(autorange = FALSE))
gi_hsr_gen_plot
# htmlwidgets::saveWidget(as_widget(gi_hsr_gen_plot), "gi_hsr_gen_plot.html")

Coluna 3

Distribuição na Bahia das linhagens de SARS-CoV-2 por semana epidemiológica

gi_hsr_epiwseq <- ddply(gi_hsr, .(gi_hsr$epiwseq, gi_hsr$oms), nrow, .drop = FALSE)
names(gi_hsr_epiwseq) <- c("epiwseq", "variants", "freq")

# gi_hsr_epiwseq_plot <- plotly::ggplotly(dynamicTicks = TRUE,
gi_hsr_epiwseq_plot <- plotly::ggplotly(
  ggplot() +
  geom_col(data = gi_hsr_epiwseq, aes(x = epiwseq, y = freq, fill = variants),
           position = position_fill(reverse = TRUE), width = .95, alpha = .6) +
  labs(x = NULL, y = NULL, fill = NULL) +
  scale_x_discrete(expand = expansion(0, 0)) +
  scale_y_continuous(labels = scales::percent, expand = expansion(0, 0)) +
  scale_fill_manual(values = c(
    "B.1" = "#FF5744",
    "B.1.1" = "#FA9084",
    "B.1.1.28" = "#E49074",
    "B.1.1.33" = "#FD9EA2",
    "VBM: Alpha" = "#DF2A8E",
    "VBM: Zeta" = "#872B15",
    "VBM: Gamma" = "#11961B",
    "VBM: Delta" = "#6F0F84",
    "VOC: Omicron (BA.1)" = "#EECB3A",
    "VOC: Omicron (BA.2)" = "#FE0B12",
    "VOC: Omicron (BA.4)" = "#D860CF",
    "VOC: Omicron (BA.5)" = "#2F67CD",
    "VOC: Omicron (BQ.1)" = "#FF7F07",
    "VOC: Omicron (XBB)" = "#36DF3B",
    "VOC: Omicron (BE.9)" = "#73FBFD",
    "VOC: Omicron (DL.1)" = "#B50B0B",
    "Others" = "#999999")) + theme_light() +
  theme(axis.text.x = element_text(angle = 45, vjust = 1, hjust = 1, size = 8),
        axis.text.y = element_text(hjust = 1, size = 8),
        legend.text = element_text(size = 8))) %>%
layout(legend = list(bgcolor = "#FFFFFF80", bordercolor = "#B3B3B3", borderwidth = .5), yaxis = list(autorange = FALSE))
# rangeslider() %>% layout(legend = list(bgcolor = "#FFFFFF80", bordercolor = "#B3B3B3", borderwidth = .5),
                          #  yaxis = list(autorange = FALSE))
gi_hsr_epiwseq_plot
# htmlwidgets::saveWidget(as_widget(gi_hsr_epiwseq_plot), "gi_hsr_epiwseq_plot.html")

HSR — Sequenciamento (Storyboard)

HSR - Produção de genomas de SARS-CoV-2 da FIOCRUZ-BA

hsr_gen_plot

HSR - Genomas de SARS-CoV-2 da Bahia submetidos no GISAID

gi_hsr_gen_plot

HSR - Distribuição na Bahia das linhagens de SARS-CoV-2 por semana epidemiológica

gi_hsr_epiwseq_plot

LabCov — Sequenciamento

Coluna 1

labcov <- redcap_sars2seq %>% filter(redcap_sars2seq$req_sequenc == "LABCOV")

labcov_seq <- n_distinct(labcov$nome_seq)

flexdashboard::valueBox(labcov_seq, 
         caption = "SEQUENCIAMENTOS REALIZADOS",
         icon = "fa-laptop-code",
         color = "#25C457")
3

labcov_sample <- n_distinct(labcov$seq_id)

flexdashboard::valueBox(labcov_sample, 
         caption = "AMOSTRAS SEQUENCIADAS",
         icon = "fa-solid fa-vial-virus",
         color = "#25C457")
36

labcov_gi <- sum(grepl("EPI_ISL", labcov$gisaid_id))

flexdashboard::valueBox(labcov_gi, 
         caption = "GENOMAS DEPOSITADOS NO GISAID",
         icon = "fa-cloud-arrow-up",
         color = "#25C457")
32

Coluna 2

Produção de genomas de SARS-CoV-2 da FIOCRUZ-BA

labcov_filt_gi <- labcov %>% filter(!is.na(gisaid_id))

labcov_filt_nogi <- labcov %>% filter(is.na(gisaid_id))

labcov_gi <- count(labcov_filt_gi$epimseq)
names(labcov_gi) <- c("epimseq", "submitted")

labcov_nogi <- count(labcov_filt_nogi$epimseq)
names(labcov_nogi) <- c("epimseq", "unsubmitted")

labcov_gen <- merge(x = labcov_gi, y = labcov_nogi, by = "epimseq", all = TRUE)
labcov_gen[is.na(labcov_gen)] <- 0
labcov_gen <- melt(labcov_gen, id.vars = "epimseq", variable.name = "gisaid")
labcov_gen <- mutate(labcov_gen, label = ifelse(gisaid == "submitted", "Online no GISAID", "Baixa cobertura (<90%)"))

labcov_gen_1 <- labcov_gen %>% filter(labcov_gen$gisaid == "unsubmitted")
labcov_gen_2 <- labcov_gen %>% filter(labcov_gen$gisaid == "submitted")

# labcov_gen_plot <- plotly::ggplotly(dynamicTicks = TRUE,
labcov_gen_plot <- plotly::ggplotly(
  ggplot() +
  geom_line(data = labcov_gen_1, linewidth = 0.6, linetype = "dotted",
            aes(x = epimseq, y = value, group = gisaid, colour = label)) +
  geom_line(data = labcov_gen_2, linewidth = 0.8,
            aes(x = epimseq, y = value, group = gisaid, colour = label)) +
  labs(x = NULL, y = NULL) +
  scale_x_discrete(expand = expansion(0, 0)) +
  scale_y_continuous(expand = expansion(0, 0), limits = c(0, 30)) +
  theme_light() + theme(axis.text.x = element_text(angle = 45, vjust = 1, hjust = 1, size = 8),
                        axis.text.y = element_text(hjust = 1, size = 8)) +
  scale_color_manual(name = NULL, values = c("#6BCFEF", "#EC4B63"))) %>%
layout(legend = list(bgcolor = "#FFFFFF80", bordercolor = "#B3B3B3", borderwidth = .5,
                     orientation = 'h', xanchor = "center", x = 0.5, y = .97))
# rangeslider() %>% layout(legend = list(bgcolor = "#FFFFFF80", bordercolor = "#B3B3B3", borderwidth = .5,
                                        #  orientation = 'h', xanchor = "center", x = 0.5, y = 1), yaxis = list(autorange = FALSE))
labcov_gen_plot
# htmlwidgets::saveWidget(as_widget(labcov_gen_plot), "labcov_gen_plot.html")

Genomas de SARS-CoV-2 da Bahia submetidos no GISAID

gi_labcov <- filter(gi, grepl("LabCoV", originating_lab, ignore.case = TRUE))

gi_labcov_gen <- count(gi_labcov$epimseq)
names(gi_labcov_gen) <- c("epimseq", "pvm")
gi_labcov_gen[is.na(gi_labcov_gen)] <- 0
gi_labcov_gen <- melt(gi_labcov_gen, id.vars = "epimseq", variable.name = "lab")
gi_labcov_gen <- mutate(gi_labcov_gen, label = "PVM (FIOCRUZ-BA)")

# gi_labcov_gen_plot <- plotly::ggplotly(dynamicTicks = TRUE,
gi_labcov_gen_plot <- plotly::ggplotly(
  ggplot() +
  geom_line(data = gi_labcov_gen, linewidth = 0.8,
            aes(x = epimseq, y = value, group = lab, colour = label)) +
  labs(x = NULL, y = NULL) +
  scale_x_discrete(expand = expansion(0, 0)) +
  scale_y_continuous(expand = expansion(0, 0), limits = c(0, 30)) +
  theme_light() + theme(axis.text.x = element_text(angle = 45, vjust = 1, hjust = 1, size = 8),
                        axis.text.y = element_text(hjust = 1, size = 8)) +
  scale_color_manual(name = NULL, values = c("#EC4B63"))) %>%
layout(legend = list(bgcolor = "#FFFFFF80", bordercolor = "#B3B3B3", borderwidth = .5,
                     orientation = 'h', xanchor = "center", x = 0.5, y = .97))
# rangeslider() %>% layout(legend = list(bgcolor = "#FFFFFF80", bordercolor = "#B3B3B3", borderwidth = .5,
                                        #  orientation = 'h', xanchor = "center", x = 0.5, y = 1), yaxis = list(autorange = FALSE))
gi_labcov_gen_plot
# htmlwidgets::saveWidget(as_widget(gi_labcov_gen_plot), "gi_labcov_gen_plot.html")

Coluna 3

Distribuição na Bahia das linhagens de SARS-CoV-2 por semana epidemiológica

gi_labcov_epiwseq <- ddply(gi_labcov, .(gi_labcov$epiwseq, gi_labcov$oms), nrow, .drop = FALSE)
names(gi_labcov_epiwseq) <- c("epiwseq", "variants", "freq")

# gi_labcov_epiwseq <- plotly::ggplotly(dynamicTicks = TRUE,
gi_labcov_epiwseq <- plotly::ggplotly(
  ggplot() +
  geom_col(data = gi_labcov_epiwseq, aes(x = epiwseq, y = freq, fill = variants),
           position = position_fill(reverse = TRUE), width = .95, alpha = .6) +
  labs(x = NULL, y = NULL, fill = NULL) +
  scale_x_discrete(expand = expansion(0, 0)) +
  scale_y_continuous(labels = scales::percent, expand = expansion(0, 0)) +
  scale_fill_manual(values = c(
    "B.1" = "#FF5744",
    "B.1.1" = "#FA9084",
    "B.1.1.28" = "#E49074",
    "B.1.1.33" = "#FD9EA2",
    "VBM: Alpha" = "#DF2A8E",
    "VBM: Zeta" = "#872B15",
    "VBM: Gamma" = "#11961B",
    "VBM: Delta" = "#6F0F84",
    "VOC: Omicron (BA.1)" = "#EECB3A",
    "VOC: Omicron (BA.2)" = "#FE0B12",
    "VOC: Omicron (BA.4)" = "#D860CF",
    "VOC: Omicron (BA.5)" = "#2F67CD",
    "VOC: Omicron (BQ.1)" = "#FF7F07",
    "VOC: Omicron (XBB)" = "#36DF3B",
    "VOC: Omicron (BE.9)" = "#73FBFD",
    "VOC: Omicron (DL.1)" = "#B50B0B",
    "Others" = "#999999")) + theme_light() +
  theme(axis.text.x = element_text(angle = 45, vjust = 1, hjust = 1, size = 8),
        axis.text.y = element_text(hjust = 1, size = 8),
        legend.text = element_text(size = 8))) %>%
layout(legend = list(bgcolor = "#FFFFFF80", bordercolor = "#B3B3B3", borderwidth = .5), yaxis = list(autorange = FALSE))
# rangeslider() %>% layout(legend = list(bgcolor = "#FFFFFF80", bordercolor = "#B3B3B3", borderwidth = .5),
                          #  yaxis = list(autorange = FALSE))
gi_labcov_epiwseq
# htmlwidgets::saveWidget(as_widget(gi_labcov_epiwseq), "gi_labcov_epiwseq.html")

LabCov — Sequenciamento (Storyboard)

LabCoV - Produção de genomas de SARS-CoV-2 da FIOCRUZ-BA

labcov_gen_plot

LabCoV - Genomas de SARS-CoV-2 da Bahia submetidos no GISAID

gi_labcov_gen_plot

LabCoV - Distribuição na Bahia das linhagens de SARS-CoV-2 por semana epidemiológica

gi_labcov_epiwseq

LACEB-BA — Sequenciamento

Coluna 1

lacen_ba <- redcap_sars2seq %>% filter(redcap_sars2seq$req_sequenc == "LACEN-BA")

lacen_ba_seq <- n_distinct(lacen_ba$nome_seq)

flexdashboard::valueBox(lacen_ba_seq, 
         caption = "SEQUENCIAMENTOS REALIZADOS",
         icon = "fa-laptop-code",
         color = "#25C457")
9

lacen_ba_sample <- n_distinct(lacen_ba$seq_id)

flexdashboard::valueBox(lacen_ba_sample, 
         caption = "AMOSTRAS SEQUENCIADAS",
         icon = "fa-solid fa-vial-virus",
         color = "#25C457")
438

lacen_ba_gi <- sum(grepl("EPI_ISL", lacen_ba$gisaid_id))

flexdashboard::valueBox(lacen_ba_gi, 
         caption = "GENOMAS DEPOSITADOS NO GISAID",
         icon = "fa-cloud-arrow-up",
         color = "#25C457")
413

Coluna 2

Produção de genomas de SARS-CoV-2 da FIOCRUZ-BA

lacen_ba_filt_gi <- lacen_ba %>% filter(!is.na(gisaid_id))

lacen_ba_filt_nogi <- lacen_ba %>% filter(is.na(gisaid_id))

lacen_ba_gi <- count(lacen_ba_filt_gi$epimseq)
names(lacen_ba_gi) <- c("epimseq", "submitted")

lacen_ba_nogi <- count(lacen_ba_filt_nogi$epimseq)
names(lacen_ba_nogi) <- c("epimseq", "unsubmitted")

lacen_ba_gen <- merge(x = lacen_ba_gi, y = lacen_ba_nogi, by = "epimseq", all = TRUE)
lacen_ba_gen[is.na(lacen_ba_gen)] <- 0
lacen_ba_gen <- melt(lacen_ba_gen, id.vars = "epimseq", variable.name = "gisaid")
lacen_ba_gen <- mutate(lacen_ba_gen, label = ifelse(gisaid == "submitted", "Online no GISAID", "Baixa cobertura (<90%)"))

lacen_ba_gen_1 <- lacen_ba_gen %>% filter(lacen_ba_gen$gisaid == "unsubmitted")
lacen_ba_gen_2 <- lacen_ba_gen %>% filter(lacen_ba_gen$gisaid == "submitted")

# lacen_ba_gen_plot <- plotly::ggplotly(dynamicTicks = TRUE,
lacen_ba_gen_plot <- plotly::ggplotly(
  ggplot() +
  geom_line(data = lacen_ba_gen_1, linewidth = 0.6, linetype = "dotted",
            aes(x = epimseq, y = value, group = gisaid, colour = label)) +
  geom_line(data = lacen_ba_gen_2, linewidth = 0.8,
            aes(x = epimseq, y = value, group = gisaid, colour = label)) +
  labs(x = NULL, y = NULL) +
  scale_x_discrete(expand = expansion(0, 0)) +
  scale_y_continuous(expand = expansion(0, 0), limits = c(0, 300)) +
  theme_light() + theme(axis.text.x = element_text(angle = 45, vjust = 1, hjust = 1, size = 8),
                        axis.text.y = element_text(hjust = 1, size = 8)) +
  scale_color_manual(name = NULL, values = c("#6BCFEF", "#EC4B63"))) %>%
layout(legend = list(bgcolor = "#FFFFFF80", bordercolor = "#B3B3B3", borderwidth = .5,
                     orientation = 'h', xanchor = "center", x = 0.5, y = .97))
# rangeslider() %>% layout(legend = list(bgcolor = "#FFFFFF80", bordercolor = "#B3B3B3", borderwidth = .5,
                                        #  orientation = 'h', xanchor = "center", x = 0.5, y = 1), yaxis = list(autorange = FALSE))
lacen_ba_gen_plot
# htmlwidgets::saveWidget(as_widget(lacen_ba_gen_plot), "lacen_ba_gen_plot.html")

Genomas de SARS-CoV-2 da Bahia submetidos no GISAID

gi_lacen_ba <- filter(gi, grepl("LACEN/BA|LACEN - Salvador|LACEN -Bahia|LACEN-BA", originating_lab, ignore.case = TRUE))

gi_lacen_ba_fiocruz <- filter(gi_lacen_ba, grepl("FIOCRUZ", submitting_lab, ignore.case = TRUE))
gi_lacen_ba_fiocruz <- count(gi_lacen_ba_fiocruz$epimseq)
names(gi_lacen_ba_fiocruz) <- c("epimseq", "fiocruz")

gi_lacen_ba_pvm <- filter(gi_lacen_ba, grepl("PVM", submitting_lab, ignore.case = TRUE))
gi_lacen_ba_pvm <- count(gi_lacen_ba_pvm$epimseq)
names(gi_lacen_ba_pvm) <- c("epimseq", "pvm")

gi_lacen_ba_lacen_ba <- filter(gi_lacen_ba, !grepl("FIOCRUZ", submitting_lab, ignore.case = TRUE))
gi_lacen_ba_lacen_ba <- count(gi_lacen_ba_lacen_ba$epimseq)
names(gi_lacen_ba_lacen_ba) <- c("epimseq", "lacen-ba")

gi_lacen_ba_gen <- Reduce(function(x, y) merge(x, y, all = TRUE), list(gi_lacen_ba_fiocruz, gi_lacen_ba_pvm, gi_lacen_ba_lacen_ba))
gi_lacen_ba_gen[is.na(gi_lacen_ba_gen)] <- 0

gi_lacen_ba_gen_1 <- gi_lacen_ba_gen[,!names(gi_lacen_ba_gen) %in% "pvm"]
gi_lacen_ba_gen_1 <- melt(gi_lacen_ba_gen_1, id.vars = "epimseq", variable.name = "lab")
gi_lacen_ba_gen_1 <- mutate(gi_lacen_ba_gen_1, label = ifelse(lab == "fiocruz", "Rede Genômica FIOCRUZ", "LACEN-BA"))

gi_lacen_ba_gen_2 <- gi_lacen_ba_gen[,!names(gi_lacen_ba_gen) %in% c("fiocruz", "lacen-ba")]
gi_lacen_ba_gen_2 <- melt(gi_lacen_ba_gen_2, id.vars = "epimseq", variable.name = "lab")
gi_lacen_ba_gen_2 <- mutate(gi_lacen_ba_gen_2, label = "PVM (FIOCRUZ-BA)")

# gi_lacen_ba_gen_plot <- plotly::ggplotly(dynamicTicks = TRUE,
gi_lacen_ba_gen_plot <- plotly::ggplotly(
  ggplot() +
  geom_line(data = gi_lacen_ba_gen_1, linewidth = 0.6, linetype = "dotted",
            aes(x = epimseq, y = value, group = lab, colour = label)) +
  geom_line(data = gi_lacen_ba_gen_2, linewidth = 0.8,
            aes(x = epimseq, y = value, group = lab, colour = label)) +
  labs(x = NULL, y = NULL) +
  scale_x_discrete(expand = expansion(0, 0)) +
  scale_y_continuous(expand = expansion(0, 0), limits = c(0, 800)) +
  theme_light() + theme(axis.text.x = element_text(angle = 45, vjust = 1, hjust = 1, size = 8),
                        axis.text.y = element_text(hjust = 1, size = 8)) +
  scale_color_manual(name = NULL, values = c("#6BCFEF", "#EC4B63", "#EC4B63"))) %>%
layout(legend = list(bgcolor = "#FFFFFF80", bordercolor = "#B3B3B3", borderwidth = .5,
                     orientation = 'h', xanchor = "center", x = 0.5, y = .97))
# rangeslider() %>% layout(legend = list(bgcolor = "#FFFFFF80", bordercolor = "#B3B3B3", borderwidth = .5,
                                        #  orientation = 'h', xanchor = "center", x = 0.5, y = 1), yaxis = list(autorange = FALSE))
gi_lacen_ba_gen_plot
# htmlwidgets::saveWidget(as_widget(gi_lacen_ba_gen_plot), "gi_lacen_ba_gen_plot.html")

Coluna 3

Distribuição na Bahia das linhagens de SARS-CoV-2 por semana epidemiológica

gi_lacen_ba_epiwseq <- ddply(gi_lacen_ba, .(gi_lacen_ba$epiwseq, gi_lacen_ba$oms), nrow, .drop = FALSE)
names(gi_lacen_ba_epiwseq) <- c("epiwseq", "variants", "freq")

# gi_lacen_ba_epiwseq_plot <- plotly::ggplotly(dynamicTicks = TRUE,
gi_lacen_ba_epiwseq_plot <- plotly::ggplotly(
  ggplot() +
  geom_col(data = gi_lacen_ba_epiwseq, aes(x = epiwseq, y = freq, fill = variants),
           position = position_fill(reverse = TRUE), width = .95, alpha = .6) +
  labs(x = NULL, y = NULL, fill = NULL) +
  scale_x_discrete(expand = expansion(0, 0)) +
  scale_y_continuous(labels = scales::percent, expand = expansion(0, 0)) +
  scale_fill_manual(values = c(
    "B.1" = "#FF5744",
    "B.1.1" = "#FA9084",
    "B.1.1.28" = "#E49074",
    "B.1.1.33" = "#FD9EA2",
    "VBM: Alpha" = "#DF2A8E",
    "VBM: Zeta" = "#872B15",
    "VBM: Gamma" = "#11961B",
    "VBM: Delta" = "#6F0F84",
    "VOC: Omicron (BA.1)" = "#EECB3A",
    "VOC: Omicron (BA.2)" = "#FE0B12",
    "VOC: Omicron (BA.4)" = "#D860CF",
    "VOC: Omicron (BA.5)" = "#2F67CD",
    "VOC: Omicron (BQ.1)" = "#FF7F07",
    "VOC: Omicron (XBB)" = "#36DF3B",
    "VOC: Omicron (BE.9)" = "#73FBFD",
    "VOC: Omicron (DL.1)" = "#B50B0B",
    "Others" = "#999999")) + theme_light() +
  theme(axis.text.x = element_text(angle = 45, vjust = 1, hjust = 1, size = 8),
        axis.text.y = element_text(hjust = 1, size = 8),
        legend.text = element_text(size = 8))) %>%
layout(legend = list(bgcolor = "#FFFFFF80", bordercolor = "#B3B3B3", borderwidth = .5), yaxis = list(autorange = FALSE))
# rangeslider() %>% layout(legend = list(bgcolor = "#FFFFFF80", bordercolor = "#B3B3B3", borderwidth = .5),
                          #  yaxis = list(autorange = FALSE))
gi_lacen_ba_epiwseq_plot
# htmlwidgets::saveWidget(as_widget(gi_lacen_ba_epiwseq_plot), "gi_lacen_ba_epiwseq_plot.html")

LACEB-BA — Sequenciamento (Storyboard)

LACEN-BA - Produção de genomas de SARS-CoV-2 da FIOCRUZ-BA

lacen_ba_gen_plot

LACEN-BA - Genomas de SARS-CoV-2 da Bahia submetidos no GISAID

gi_lacen_ba_gen_plot

LACEN-BA - Distribuição na Bahia das linhagens de SARS-CoV-2 por semana epidemiológica

gi_lacen_ba_epiwseq_plot

LJC — Sequenciamento

Coluna 1

ljc <- redcap_sars2seq %>% filter(redcap_sars2seq$req_sequenc == "LJC")

ljc_seq <- n_distinct(ljc$nome_seq)

flexdashboard::valueBox(ljc_seq, 
         caption = "SEQUENCIAMENTOS REALIZADOS",
         icon = "fa-laptop-code",
         color = "#25C457")
2

ljc_sample <- n_distinct(ljc$seq_id)

flexdashboard::valueBox(ljc_sample, 
         caption = "AMOSTRAS SEQUENCIADAS",
         icon = "fa-solid fa-vial-virus",
         color = "#25C457")
50

ljc_gi <- sum(grepl("EPI_ISL", ljc$gisaid_id))

flexdashboard::valueBox(ljc_gi, 
         caption = "GENOMAS DEPOSITADOS NO GISAID",
         icon = "fa-cloud-arrow-up",
         color = "#25C457")
43

Coluna 2

LJC - Produção de genomas de SARS-CoV-2 da FIOCRUZ-BA

ljc_filt_gi <- ljc %>% filter(!is.na(gisaid_id))

ljc_filt_nogi <- ljc %>% filter(is.na(gisaid_id))

ljc_gi <- count(ljc_filt_gi$epimseq)
names(ljc_gi) <- c("epimseq", "submitted")

ljc_nogi <- count(ljc_filt_nogi$epimseq)
names(ljc_nogi) <- c("epimseq", "unsubmitted")

ljc_gen <- merge(x = ljc_gi, y = ljc_nogi, by = "epimseq", all = TRUE)
ljc_gen[is.na(ljc_gen)] <- 0
ljc_gen <- melt(ljc_gen, id.vars = "epimseq", variable.name = "gisaid")
ljc_gen <- mutate(ljc_gen, label = ifelse(gisaid == "submitted", "Online no GISAID", "Baixa cobertura (<90%)"))

ljc_gen_1 <- ljc_gen %>% filter(ljc_gen$gisaid == "unsubmitted")
ljc_gen_2 <- ljc_gen %>% filter(ljc_gen$gisaid == "submitted")

# ljc_gen_plot <- plotly::ggplotly(dynamicTicks = TRUE,
ljc_gen_plot <- plotly::ggplotly(
  ggplot() +
  geom_line(data = ljc_gen_1, linewidth = 0.6, linetype = "dotted",
            aes(x = epimseq, y = value, group = gisaid, colour = label)) +
  geom_line(data = ljc_gen_2, linewidth = 0.8,
            aes(x = epimseq, y = value, group = gisaid, colour = label)) +
  labs(x = NULL, y = NULL) +
  scale_x_discrete(expand = expansion(0, 0)) +
  scale_y_continuous(expand = expansion(0, 0), limits = c(0, 100)) +
  theme_light() + theme(axis.text.x = element_text(angle = 45, vjust = 1, hjust = 1, size = 8),
                        axis.text.y = element_text(hjust = 1, size = 8)) +
  scale_color_manual(name = NULL, values = c("#6BCFEF", "#EC4B63"))) %>%
layout(legend = list(bgcolor = "#FFFFFF80", bordercolor = "#B3B3B3", borderwidth = .5,
                     orientation = 'h', xanchor = "center", x = 0.5, y = .97))
# rangeslider() %>% layout(legend = list(bgcolor = "#FFFFFF80", bordercolor = "#B3B3B3", borderwidth = .5,
                                        #  orientation = 'h', xanchor = "center", x = 0.5, y = 1), yaxis = list(autorange = FALSE))
ljc_gen_plot
# htmlwidgets::saveWidget(as_widget(ljc_gen_plot), "ljc_gen_plot.html")

LJC - Genomas de SARS-CoV-2 da Bahia submetidos no GISAID

gi_ljc <- filter(gi, grepl("LJC", originating_lab, ignore.case = TRUE))

gi_ljc_gen <- count(gi_ljc$epimseq)
names(gi_ljc_gen) <- c("epimseq", "pvm")
gi_ljc_gen[is.na(gi_ljc_gen)] <- 0
gi_ljc_gen <- melt(gi_ljc_gen, id.vars = "epimseq", variable.name = "lab")
gi_ljc_gen <- mutate(gi_ljc_gen, label = "PVM (FIOCRUZ-BA)")

# gi_ljc_gen_plot <- plotly::ggplotly(dynamicTicks = TRUE,
gi_ljc_gen_plot <- plotly::ggplotly(
  ggplot() +
  geom_line(data = gi_ljc_gen, linewidth = 0.8,
            aes(x = epimseq, y = value, group = lab, colour = label)) +
  labs(x = NULL, y = NULL) +
  scale_x_discrete(expand = expansion(0, 0)) +
  scale_y_continuous(expand = expansion(0, 0), limits = c(0, 30)) +
  theme_light() + theme(axis.text.x = element_text(angle = 45, vjust = 1, hjust = 1, size = 8),
                        axis.text.y = element_text(hjust = 1, size = 8)) +
  scale_color_manual(name = NULL, values = c("#EC4B63"))) %>%
layout(legend = list(bgcolor = "#FFFFFF80", bordercolor = "#B3B3B3", borderwidth = .5,
                     orientation = 'h', xanchor = "center", x = 0.5, y = .97))
# rangeslider() %>% layout(legend = list(bgcolor = "#FFFFFF80", bordercolor = "#B3B3B3", borderwidth = .5,
                                        #  orientation = 'h', xanchor = "center", x = 0.5, y = 1), yaxis = list(autorange = FALSE))
gi_ljc_gen_plot
# htmlwidgets::saveWidget(as_widget(gi_ljc_gen_plot), "gi_ljc_gen_plot.html")

Coluna 3

LabCoV - Distribuição na Bahia das linhagens de SARS-CoV-2 por semana epidemiológica

gi_ljc_epiwseq <- ddply(gi_ljc, .(gi_ljc$epiwseq, gi_ljc$oms), nrow, .drop = FALSE)
names(gi_ljc_epiwseq) <- c("epiwseq", "variants", "freq")

# gi_ljc_epiwseq_plot <- plotly::ggplotly(dynamicTicks = TRUE,
gi_ljc_epiwseq_plot <- plotly::ggplotly(
  ggplot() +
  geom_col(data = gi_ljc_epiwseq, aes(x = epiwseq, y = freq, fill = variants),
           position = position_fill(reverse = TRUE), width = .95, alpha = .6) +
  labs(x = NULL, y = NULL, fill = NULL) +
  scale_x_discrete(expand = expansion(0, 0)) +
  scale_y_continuous(labels = scales::percent, expand = expansion(0, 0)) +
  scale_fill_manual(values = c(
    "B.1" = "#FF5744",
    "B.1.1" = "#FA9084",
    "B.1.1.28" = "#E49074",
    "B.1.1.33" = "#FD9EA2",
    "VBM: Alpha" = "#DF2A8E",
    "VBM: Zeta" = "#872B15",
    "VBM: Gamma" = "#11961B",
    "VBM: Delta" = "#6F0F84",
    "VOC: Omicron (BA.1)" = "#EECB3A",
    "VOC: Omicron (BA.2)" = "#FE0B12",
    "VOC: Omicron (BA.4)" = "#D860CF",
    "VOC: Omicron (BA.5)" = "#2F67CD",
    "VOC: Omicron (BQ.1)" = "#FF7F07",
    "VOC: Omicron (XBB)" = "#36DF3B",
    "VOC: Omicron (BE.9)" = "#73FBFD",
    "VOC: Omicron (DL.1)" = "#B50B0B",
    "Others" = "#999999")) + theme_light() +
  theme(axis.text.x = element_text(angle = 45, vjust = 1, hjust = 1, size = 8),
        axis.text.y = element_text(hjust = 1, size = 8),
        legend.text = element_text(size = 8))) %>%
layout(legend = list(bgcolor = "#FFFFFF80", bordercolor = "#B3B3B3", borderwidth = .5), yaxis = list(autorange = FALSE))
# rangeslider() %>% layout(legend = list(bgcolor = "#FFFFFF80", bordercolor = "#B3B3B3", borderwidth = .5),
                          #  yaxis = list(autorange = FALSE))
gi_ljc_epiwseq_plot
# htmlwidgets::saveWidget(as_widget(gi_ljc_epiwseq_plot), "gi_ljc_epiwseq_plot.html")

LJC — Sequenciamento (Storyboard)

LJC - Produção de genomas de SARS-CoV-2 da FIOCRUZ-BA

ljc_gen_plot

LJC - Genomas de SARS-CoV-2 da Bahia submetidos no GISAID

gi_ljc_gen_plot

LJC - Distribuição na Bahia das linhagens de SARS-CoV-2 por semana epidemiológica

gi_ljc_epiwseq_plot